(function(angular) {
	"use strict";
	angular.module("fs.waf").controller("cls.popup.extrequest.viewResponseController", viewResponseController);
	viewResponseController.$inject = [ "$scope", "$q", "$uibModalInstance", "dialogsModule", "layoutConfig", "validatorConfig", "authService" ];
	function viewResponseController($scope, $q, $uibModalInstance, dialogsModule, layoutConfig, validatorConfig, authService) {
		var ctrl = this;
		ctrl.dialogsModule = dialogsModule;
		ctrl.validatorConfig = validatorConfig;
		ctrl.extRequest = {};

		ctrl.close = function() {
			if (!dialogsModule.btnCallback || !dialogsModule.btnCallback["close"] || dialogsModule.btnCallback["close"]() !== false) {
				$uibModalInstance.dismiss();
			}
		};

		ctrl.init = function() {
			authService.view(ctrl.dialogsModule.params).then(function(response) {
				if (response.data && response.data.length > 0) {
					ctrl.layoutConfig = layoutConfig;
					ctrl.extRequest.requestId = response.data[0].requestId;
					ctrl.extResponseList = response.data;
				}
			});
		};
	}
})(angular);
